import { createApp,h } from 'vue'
import App from './App.vue'
import './index.css'
import router from './route/router.js'
import store from './vuex/store.js'
// import { Swipe, SwipeItem } from 'vant'


router.beforeEach( (to,from,next)=>{
    next()
})


//设置全局的路由守卫，获取加载条的状态
router.beforeEach((to,from,next)=>{
    store.dispatch('setNowStatus','loading')
    next()
})

router.afterEach(()=>{
    //结束状态，width 100%
    store.commit('setNowStatus', 'end')
    //设置隐藏， 透明度 0
    setTimeout(()=>{
      store.commit('setNowStatus', 'hide')
    }, 900)
    //高度设置为0
    setTimeout(()=>{
      store.commit('setNowStatus', 'normal')
    }, 1000)
  
  })



const app = createApp(App)
app.use(router)
app.use(store)
// app.use(Swipe)
// app.use(SwipeItem)
// app.use(Lazyload)
app.mount('#app')


